/*
 * Copyright (c) 2008, Xiong Yingfei, the University of Tokyo
 * All rights reserved.
 */
package ac.jp.u_tokyo.SyncLib;

public class NullMod<T> implements Mod<T>
{
	
	@Override
	public String toString()
	{
		return "nomod";
	}

	private NullMod() {
		
	}

	public T apply(T value)
	{
		return value;
	}

	public Mod<T> getInverse(T value)
	{
		return this;
	}

	public T inPlaceApply(T value)
	{
		return value;
	}

	public boolean isConflict(Mod<T> m)
	{
		return false;
	}

	public Mod<T> merge(Mod<T> latter)
	{
		return latter;
	}
	
	
	
	@Override
	public boolean equals(Object obj)
	{
		return obj instanceof NullMod;
	}

	@Override
	public int hashCode()
	{
		return super.hashCode();
	}



	public  static NullMod INSTANCE = new NullMod();



	public Mod<T> subtract(Mod<T> subtrahend)
	{
//		assert this.merge(subtrahend).equals(this);
//		return NullMod.INSTANCE;
		return subtrahend;
	}


}
